package models

import (
    "go-dingding/go-common/config"
    "go-dingding/go-common/utils"
)

type DingTalkModel struct {
    Metric  string                 `json:"Metric,omitempty"`
    MetricAlarm string                 `json:"MetricAlarm,omitempty"`
}

func SendDingtalk(dingTalkModel *DingTalkModel) (err error)  {
    ding := utils.Dingtalk{}
	ding.DingtalkURL = config.GetString("DingtalkURL")
	ding.DingtalkName = config.GetString("DingtalkName")
	var msg = dingTalkModel.Metric + "：" + dingTalkModel.MetricAlarm
	return ding.SenMarkdown(ding.DingtalkName, msg)
}

